<template>
  <div>
    <!--头部-->
    <div class="line">
      <van-row class="row">
        <van-col span="4">
          <van-icon name="arrow-left" @click="reback" />
        </van-col>
        <van-col span="16" style="text-align: center; font-size: 14px">采购管理</van-col>
        <van-col span="4" style="text-align: right">
          <van-icon name="search" />
          <van-icon name="apps-o" />
        </van-col>
      </van-row>
    </div>

    <!--标签页-->
    <div>
      <van-tabs v-model:active="active" animated @click-tab="chg">
        <van-tab title="全部采购"></van-tab>
        <van-tab title="待审核"></van-tab>
        <van-tab title="已审核"></van-tab>
      </van-tabs>
      <!--内容组件-->
      <AllPurchase ref="AllRef" @getNum="passValue"></AllPurchase>
    </div>

    <!--底部-->
    <div class="footer">
      <div>合计：{{num}}条</div>
      <div class="btn-a">新增采购单</div>
    </div>
  </div>
</template>

<script setup>
import {
  Col as VanCol,
  Row as VanRow,
  Icon as VanIcon,
  Tabbar as VanTabbar,
  TabbarItem as VanTabbarItem,
} from "vant";
import { ref, onMounted,computed } from "vue";

import { Tabs as VanTabs, Tab as VanTab } from "vant";
import AllPurchase from "../component/purchaseCont.vue";
import { useRouter } from "vue-router";

//属性区

//路由实例
const router = useRouter();

const active = ref(0);
//采购列表组件引用
const AllRef = ref(null);
//采购单数量
const num =ref(0)


//方法区

let passValue = (data)=>{
  num.value=data
}

//切换标签时
let chg = (s) => {
  AllRef.value.chgInit(s.name);
};

//返回
let reback = () => {
  router.back();
};

</script>

<style scope>
* {
  margin: 0;
  padding: 0;
}

.row {
  padding: 0.1rem;
  height: 0.5rem;
  line-height: 0.5rem;
  color: #666666;
}

.line {
  border-bottom: 1px solid #e2e2e2;
}
.footer {
  width: 7.5rem;
  height: 1rem;
  line-height: 1rem;
  font-size: 16px;
  color: #666;
  background-color: #F2F2F2;
  position: fixed;
  bottom: 0;
  display: flex;
  justify-content: space-between;
  padding: 0 0.2rem;
  box-sizing: border-box;

}

.btn-a{
  height: 0.5rem;
  text-align: center;
  line-height: 0.5rem;
  margin: auto 0;
  border: 1px solid red;
  border-radius: 0.1rem;
  color: red;
  padding: 0.06rem 0.15rem;
  font-size: 14px;


}
</style>
